package com.tedu.controller;

import com.tedu.pojo.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException;

/**
 * Author：毕龙
 * Date: 2023/12/21 19:45
 * Controller标注该类是一个控制器 注入到SpringBoot IOC容器中
 */
@Controller
@ResponseBody
public class HelloController{

    public String hello(){
        return "陈馨惢是一个好姑娘！！！";
    }

    @Autowired
    private Student student;

    @RequestMapping("/stu")
    public Student getStudent(){
        return student.setName("京京").setAge(18);
    }

    @RequestMapping("/stu1")
    public Student getStudent1()  {

        return student;
    }

}
